import System
import SecureBusiness

-- entry point
main = do
    args <- getArgs

    -- current user roles
    userRoles <- return $ map Role args

    -- example of a call-level security control
    putStrLn $ secureGreet' $ secureGreet userRoles

    -- example of a function-level security control usage
    -- here a handler is already defined so the function is secured
    putStrLn $ securedAdd 2 3 userRoles                         -- args here

    -- another example of a call-level security control
    putStrLn $ securePowerPower' $ securePowerPower userRoles

  where

    -- example of a call-level security handler definition
    secureGreet' (Just f) = f "buddy"                           -- args here
    secureGreet' Nothing  = "Go Away!"

    -- the return type can be anything so its a usecase specific call
    -- here we map a Double to a String
    securePowerPower' (Just f) = show $ f 2 3 4                 -- args here
    securePowerPower' Nothing  = "Access Denied."

